using System;
using System.Windows;
using System.Windows.Data;

namespace Tycho.Peyote {
    [ValueConversion (typeof (Boolean), typeof (Visibility))]
    public class BooleanToVisibilityConverter : IValueConverter {
        public bool Invert { get; set; }

        public object Convert (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            bool b = (bool) value;
            return (b ^ Invert) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object ConvertBack (object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            throw new NotImplementedException ();
        }
    }
}